package com.neuedu.dao.impl;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.neuedu.dao.LikeDao;
import com.neuedu.model.Like;

@Repository
public class LikeDaoImpl implements LikeDao {

	// 代码层级的整合spring+mybatis
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate) {
		this.sqlSessionTemplate = sqlSessionTemplate;
	}

	@Override
	public int countLike() {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(LikeDao.class).countLike();
	}

	@Override
	public List<Like> findAll(Map<String, Object> map) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(LikeDao.class).findAll(map);
	}

	@Override
	public int addLike(Like l) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(LikeDao.class).addLike(l);
	}

	@Override
	public int deleteLike(int id) {
		// TODO 自动生成的方法存根
		return sqlSessionTemplate.getMapper(LikeDao.class).deleteLike(id);
	}

}
